package cc.shacocloud.luanniao.web.controller.interceptor

import cc.shacocloud.luanniao.core.model.constant.UserAuthRoleEnum

/**
 * 使用该注解标识则标识该接口的认证规则
 *
 * @author 思追(shaco)
 */
@Target(
    AnnotationTarget.FUNCTION,
    AnnotationTarget.CLASS
)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
annotation class Auth(
    /**
     * 满足认证条件的角色
     */
    val role: UserAuthRoleEnum,
)

/**
 * 管理员认证
 *
 * @author 思追(shaco)
 */
@Target(
    AnnotationTarget.FUNCTION,
    AnnotationTarget.CLASS
)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Auth(
    role = UserAuthRoleEnum.ADMIN
)
annotation class AdminAuth

/**
 * 普通用户认证
 *
 * @author 思追(shaco)
 */
@Target(
    AnnotationTarget.FUNCTION,
    AnnotationTarget.CLASS
)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Auth(
    role = UserAuthRoleEnum.USER
)
annotation class UserAuth

/**
 * 未登录用户认证
 *
 * 使用该注解标识则标识该接口不需要认证即可访问
 *
 * @author 思追(shaco)
 */
@Target(
    AnnotationTarget.FUNCTION,
    AnnotationTarget.CLASS
)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Auth(
    role = UserAuthRoleEnum.NOT_LOGGED_USER
)
annotation class NotLoggedUserAuth

